<template>
  <div>
    <div class="title">购买记录</div>
    <div class="list">
      <div class="col" v-for="item in list" :key="item.id">
        <div class="item">
          <div class="left">
            <div class="imgDiv">
              <img :src="item.goods[0].images.image_url" alt="" />
            </div>
            <div class="text">
              <div class="name">{{ item.goods[0].images.title_cn }}</div>
              <div class="time">{{ item.returntime_text }}</div>
            </div>
          </div>
          <div class="right">
            <div
              class="btn buy pointer"
              @click="download(item.goods[0].images.image_url)"
            >
              点击下载
            </div>
            <!--<div class="btn sale pointer">售出</div> -->
            <div class="num">¥{{ item.total }}</div>
          </div>
        </div>
      </div>
    </div>
    <pagination
      :total="total"
      :currentPage="page"
      :pageSize="rows"
      @handleCurrentChange="handleCurrentChange"
    />
  </div>
</template>
  
 <script>
export default {
  name: "NavBar",
  components: {
    pagination: () => import("@/components/pagination.vue"),
  },
  data() {
    return {
      page: 1,
      rows: 9,
      total: 0,
      list: [],
      url: "/uploads/20250425/fc9516b2737224623471e578d54e7c15.jpg",
    };
  },
  mounted() {
    this.getList();
  },
  methods: {
    getList() {
      this.$post("/order/order_list", {
        page: this.page,
        rows: this.rows,
        order_status: "",
      }).then((res) => {
        this.list = res.data.data;
        this.total = res.data.total;
      });
    },
    handleCurrentChange(e) {
      this.page = e;
      this.getList();
    },
    async download(url) {
      window.open(url, "_blank");
    },
  },
};
</script>
  
<style scoped lang="scss">
.title {
  font-size: 24px;
}
.list {
  .col {
    padding: 30px 0;
    border-bottom: 2px dotted #aaa;
    .item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      .left {
        display: flex;
      }
      .right {
        text-align: right;
        .buy {
          color: #fb0101;
        }
        .sale {
          color: #0171fb;
        }
        .num {
          font-size: 30px;
        }
      }
    }
    .text {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }
    .imgDiv {
      height: 92px;
      width: 92px;
      border-radius: 8px;
      margin-right: 30px;
    }
  }
}
@media screen and (max-width: 768px) {
}
</style>
  